<template>
	<view class="friend-item" @click="showFriendInfo()">
		<head-image :name="student.name" :id="student.id" :size="90"></head-image>
		<view class="friend-info">
			<view class="friend-name">{{student.name}}</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {}
		},
		methods: {
			showFriendInfo() {
				uni.navigateTo({
					url: this.finalUrl
				})
			},
		},
		props: {
			student: {
				type: Object
			},
			url: {
				type: String,
				default: "/pages/student/student-info?id="
			}
		},
		computed: {
			finalUrl() {
				if (this.student && this.student._id) {
					return this.url + this.student._id;
				}
				return this.url;
			}
		}
	}
</script>

<style scope lang="scss">
	.friend-item {
		height: 100rpx;
		display: flex;
		margin-bottom: 1rpx;
		position: relative;
		padding: 10rpx;
		padding-left: 20rpx;
		align-items: center;
		background-color: white;
		white-space: nowrap;

		&:hover {
			background-color: #f5f6ff;
		}

		.friend-info {
			flex: 1;
			display: flex;
			flex-direction: column;
			padding-left: 20rpx;
			text-align: left;

			.friend-name {
				font-size: 30rpx;
				font-weight: 600;
				line-height: 60rpx;
				white-space: nowrap;
				overflow: hidden;
			}
		}
	}
</style>